package com.interview.gc;

import java.nio.ByteBuffer;
import java.util.concurrent.TimeUnit;

/**
 * Copyright (C), 2018-2020
 * FileName: DirectBufferMemoryDemo
 * Author:   kongfanyu
 * Date:     2020/10/15 10:43
 * -Xms10m -Xmx10m -XX:+PrintGCDetails -XX:MaxDirectMemorySize=5m
 */
public class DirectBufferMemoryDemo {
    public static void main(String[] args) {
        System.out.println("系统默认的maxDirectoryMemory:"+ (sun.misc.VM.maxDirectMemory()/1024/1024) + "MB" );
        try { TimeUnit.SECONDS.sleep(3); } catch (InterruptedException e) { e.printStackTrace(); }
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(6 * 1024 * 1024);
    }

}
